package map;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class MainClass {
	public static Map<String, String> hashMap = new HashMap<String, String>();

	public static void main(String[] args) throws InterruptedException {
		 hashMap = Collections.synchronizedMap(hashMap);
		Thread t1 = new Thread() {
			public void run() {
				for (int i = 0; i < 25; i++) {
					hashMap.put(String.valueOf(i), String.valueOf(i));
				}
			}
		};

		Thread t2 = new Thread() {
			public void run() {
				for (int j = 0; j < 25; j++) {
					hashMap.put(String.valueOf(j), String.valueOf(j));
				}
			}
		};

		t1.start();
		t2.start();

		Thread.sleep(1000);

		for (int i = 0; i < 25; i++) {
			System.err.println(i + ":" + hashMap.get(String.valueOf(i)));
		}
	}
}
